﻿/*----------------------------------------------------
 * Author : Tharinduni Udugamasuriya
 * FinCon dll for Handeling DB 
 * FinColumnWithValue : Table Column VAlues
 ---------------------------------------------------*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DSPL.Contracts;
using DSPL.Contracts.Interfaces;

namespace DSPL.DataAccess
{
    public class ColumnWithValue : IColumnWithValue
    {
        #region Decalare & Assign Public Variables

        public string ColumnName { get; set; }

        public object ColumnValue { get; set; }

        public QDataType ColumnDataType { get; set; }

        public QLogicOperator ColumnConnector { get; set; }

        public QComparison Comparison { get; set; }

        public string FromTable { get; set; }

        public string FromColumn { get; set; }

        public string ToTable { get; set; }

        public string ToColumn { get; set; }

        public QJoinType JoinType { get; set; }

        public QOrderby OrderBy { get; set; }

        public int Level { get; set; }

        #endregion

        #region Methods

        public List<IColumnWithValue> CreateIColumnWithValueList(List<Tuple<string, object, QDataType>> columnList)
        {
            List<IColumnWithValue> IColumnWithValueList = new List<IColumnWithValue>();

            for (int i = 0; i < columnList.Count; i++)
            {
                IColumnWithValueList.Add(new ColumnWithValue() { ColumnName = columnList[i].Item1.ToString(), ColumnValue = columnList[i].Item2, ColumnDataType = columnList[i].Item3 });
            }

            return IColumnWithValueList;
        }

        #endregion

    }
}
